﻿#pragma once
#ifndef NETSNAKE_H
#define NETSNAKE_H
#include <QWidget>
#include <qqueue.h>
#include <qset.h>
#include "../MultiSnake/MultiSnake.h"
#include "../../Networks/GameNet/Client/GameClient.h"
#include <QKeyEvent>


class NetSnake : public MultiSnake
{
	Q_OBJECT;
public:
	NetSnake(QWidget* parent, int cellNum, int cellLen);
	~NetSnake();
	void keyEvent(QKeyEvent* event);
	void init();

protected:
	void initCurrentPlayer();
	void initPlayerPosition(int i,Player* player,bool isCurrent);
	void initOtherPlayers();
	void initNetWrok();
	void doKeyEvent();
	void doNetEvent();
	void updateOtherPlayers();
protected slots:
	void loopGame();
private:
	GameClient* client;
	QSet<Player*>* otherSnakes = new QSet<Player*>();
	QQueue<char*>* farme‌Queue = new QQueue<char*>();
	int id = 0;
};

#endif NETSNAKE_H

